/*
  学习目标：useEffect的基本使用
  步骤：
     1. 导入useEffect
     2. 调用useEffect
*/

import React, { useState, useEffect } from 'react';

export default function App() {
  const [count, setCount] = useState(0);

  useEffect(() => {
    // 回调函数会自动执行
    console.log('count  ----->  ', count);
    document.title = count;
  });

  return (
    <div>
      <h1>{count}</h1>
      <button onClick={() => setCount(count + 1)}>点我+1</button>
    </div>
  );
}
